package cn.com.test.common.filter;


import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/*//加了asyncSupported=true之后，事务可以异步执行，不阻塞
@WebFilter(filterName = "filter3",urlPatterns = "/web/action",asyncSupported = true)
public class Filter3 implements Filter {
	@Override
	public void init(FilterConfig filterConfig) throws ServletException {
		System.out.println("Filter3init");
	}

	@Override
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
	ServletException {
		System.out.println("Filter3doFilter");
*//*		AsyncContext context = request.startAsync();
		context.start(new Runnable() {
			@Override
			public void run() {
				try {
					Thread.sleep(3000);
					System.out.println("等待结束！");
				}catch (Exception e) {
					e.printStackTrace();
				}
			}
		});*//*
		chain.doFilter(request,response);
	}

	@Override
	public void destroy() {
		System.out.println("Filter3destroy");
	}
}*/
